import { getSStore, removeSStore } from "@/utils/util"

import Joseph from "../../../images/avatar/Joseph.jpg"
import Viola from "../../../images/avatar/Viola.jpg"
import Hubery from "../../../images/avatar/Hubery.jpg"
import Michael from "../../../images/avatar/Michael.jpg"
import defaultAvatar from "../../../images/task/avatar.jpg"

export default {
	name: 'task',
	data() {
		return {
			user: null,
			avatarStyle: null,
			menus: [{
					name: '我的差旅',
					auth: true,
					count: '',
					path: '/home/task/mytravel'
				},
				{
					name: '差旅审批',
					auth: true,
					count: '',
					path: '/home/task/travelapproval'
				},
				{
					name: '行程预定',
					auth: true,
					count: '',
					path: '/home/task/travelbooking'
				}
			],
		}
	},
	computed: {

	},
	watch: {

	},
	methods: {

		//个人设置
		personalSetting() {
			this.$router.push({ path: '/home/task/personalsetting' })
		},
		//头像设置
		setAvatar() {
			const user = JSON.parse(getSStore('user'))
			if(user.name == "刘勇锐") {
				return Joseph;
			}
			if(user.name == "严岩昕") {
				return Viola;
			}
			if(user.name == "张辰屹") {
				return Hubery;
			}
			if(user.name == "柳辰飞") {
				return Michael;
			} else {
				return defaultAvatar;
			}
		}
	},
	components: {

	},
	created() {
		this.user = JSON.parse(getSStore('user'));
		this.avatarStyle = {backgroundImage: "url(" + this.setAvatar() + ")"};
	}
}
